/**
 * @Project Name:hoofungson-elk-log
 * @Package Name:cn.hoofungson.framework.elk.log.util
 * @Since JDK 1.8
 */

package cn.hoofungson.framework.elk.log.util;

/**
 * @Description: 操作系统工具
 * @Author 胡松 hoofungson@163.com
 * @Date 2019-09-11 10:22
 * @Version V1.0
 */
public class OperationSystemUtils {

    /**
     * windows
     **/
    private static Boolean isWindows;

    /**
     * linux
     **/
    private static Boolean isLinux;

    /**
     * mac
     **/
    private static Boolean isMac;

    /**
     * 操作系统名称
     **/
    private static String operationSystemName;

    private OperationSystemUtils() {
    }

    static {
        operationSystemName = System.getProperty("os.name");
        if (operationSystemName != null)
            operationSystemName = operationSystemName.toLowerCase();
        isMac = operationSystemName != null && operationSystemName.indexOf("mac") != -1;
        isWindows = operationSystemName != null && operationSystemName.indexOf("windows") != -1;
        isLinux = operationSystemName != null && operationSystemName.indexOf("linux") != -1;
    }

    public static Boolean getIsWindows() {
        return isWindows;
    }

    public static Boolean getIsLinux() {
        return isLinux;
    }

    public static Boolean getIsMac() {
        return isMac;
    }

    public static String getOperationSystemName() {
        return operationSystemName;
    }
}
